#include <gtest/gtest.h>
#include "scheduler/if_then_else_scheduler.h"
#include "scheduler/scheduler_factory.h"
#include "../sample/navigation_task.h"
#include "../sample/battery_level_check.h"
#include "../sample/docking_task.h"

TEST(test_if_else_scheduler_demo, test_if_else_scheduler)
{
    auto navigation_task = task::TaskFactory<NavigationTask>::createTask("navigation_task");
    auto battery_level_check = task::TaskFactory<BatteryLevelCheck>::createTask("battery_level_check");
    auto docking_task = task::TaskFactory<DockingTask>::createTask("docking_task");

    auto if_else_scheduler = scheduler::SchedulerFactory<scheduler::IfThenElseScheduler>::createScheduler("if_else_scheduler");
    if_else_scheduler->setConditionTask(battery_level_check);
    if_else_scheduler->setThenTask(docking_task);
//    if_else_scheduler->setElseTask(navigation_task);

    if_else_scheduler->run();
    EASE_INFO("done");
}

TEST(test_if_else_scheduler_demo2, test_if_else_scheduler)
{
    auto navigation_task = task::TaskFactory<NavigationTask>::createTask("navigation_task");
    auto battery_level_check = task::TaskFactory<BatteryLevelCheck>::createTask("battery_level_check");
    auto docking_task = task::TaskFactory<DockingTask>::createTask("docking_task");

    auto if_else_scheduler = scheduler::SchedulerFactory<scheduler::IfThenElseScheduler>::createScheduler("if_else_scheduler");
    if_else_scheduler->setElseTask(navigation_task);
    if_else_scheduler->setConditionTask(battery_level_check);
    if_else_scheduler->setThenTask(docking_task);

    if_else_scheduler->run();
    EASE_INFO("done");
}

TEST(test_if_else_scheduler_demo3, test_if_else_scheduler)
{
    auto navigation_task = task::TaskFactory<NavigationTask>::createTask("navigation_task");
    auto battery_level_check = task::TaskFactory<BatteryLevelCheck>::createTask("battery_level_check");
    auto docking_task = task::TaskFactory<DockingTask>::createTask("docking_task");

    auto if_else_scheduler = scheduler::SchedulerFactory<scheduler::IfThenElseScheduler>::createScheduler("if_else_scheduler");
    if_else_scheduler->setElseTask(navigation_task);
    if_else_scheduler->setThenTask(docking_task);
    if_else_scheduler->setConditionTask(battery_level_check);

    if_else_scheduler->run();
    EASE_INFO("done");
}
